package leetcode.bfs.common;

import leetcode.tree.common.TreeNode;
import leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution6335 {
    public TreeNode replaceValueInTree(TreeNode root) {
        return BFSUtils.replaceValueInTree(root);
    }
}

public class leetcode6335 {
    public static void main(String[] args) {
        Solution6335 solution6335 = new Solution6335();
        Integer[] nums = {5, 4, 9, 1, 10, null, 7};
        Integer[] nums1 = {3, 1, 2};
        test6335(solution6335, nums);
        test6335(solution6335, nums1);
    }

    private static void test6335(Solution6335 solution6335, Integer[] nums) {
        TreeNode root = solution6335.replaceValueInTree(TreeUtils.generateLeetcodeTree(nums));
        System.out.println(TreeUtils.getLeetcodeTreeVals(root));
    }
}
